
/*
'===============================================================================
'  Generated From - CSharp_dOOdads_BusinessEntity.vbgen
' 
'  ** IMPORTANT  ** 
'  How to Generate your stored procedures:
' 
'  SQL        = SQL_StoredProcs.vbgen
'  ACCESS     = Access_StoredProcs.vbgen
'  ORACLE     = Oracle_StoredProcs.vbgen
'  FIREBIRD   = FirebirdStoredProcs.vbgen
'  POSTGRESQL = PostgreSQL_StoredProcs.vbgen
'
'  The supporting base class SqlClientEntity is in the Architecture directory in "dOOdads".
'  
'  This object is 'abstract' which means you need to inherit from it to be able
'  to instantiate it.  This is very easilly done. You can override properties and
'  methods in your derived class, this allows you to regenerate this class at any
'  time and not worry about overwriting custom code. 
'
'  NEVER EDIT THIS FILE.
'
'  public class YourObject :  _YourObject
'  {
'
'  }
'
'===============================================================================
*/

// Generated by MyGeneration Version # (1.3.0.3)

using System;
using System.Data;
using System.Data.SqlClient;
using System.Collections;
using System.Collections.Specialized;

using MyGeneration.dOOdads;

namespace DataAccess.Modules.Entity.Production
{
	public abstract class _ProductionOwnProductStatus : SqlClientEntity
	{
		public _ProductionOwnProductStatus()
		{
			this.QuerySource = "ProductionOwnProductStatus";
			this.MappingName = "ProductionOwnProductStatus";

		}	

		//=================================================================
		//  public Overrides void AddNew()
		//=================================================================
		//
		//=================================================================
		public override void AddNew()
		{
			base.AddNew();
			
		}
		
		
		public override void FlushData()
		{
			this._whereClause = null;
			this._aggregateClause = null;
			base.FlushData();
		}
		
		//=================================================================
		//  	public Function LoadAll() As Boolean
		//=================================================================
		//  Loads all of the records in the database, and sets the currentRow to the first row
		//=================================================================
		public bool LoadAll() 
		{
			ListDictionary parameters = null;
			
			return base.LoadFromSql("[" + this.SchemaStoredProcedure + "proc_ProductionOwnProductStatusLoadAll]", parameters);
		}
	
		//=================================================================
		// public Overridable Function LoadByPrimaryKey()  As Boolean
		//=================================================================
		//  Loads a single row of via the primary key
		//=================================================================
		public virtual bool LoadByPrimaryKey(int IdOwnProduct)
		{
			ListDictionary parameters = new ListDictionary();
			parameters.Add(Parameters.IdOwnProduct, IdOwnProduct);

		
			return base.LoadFromSql("[" + this.SchemaStoredProcedure + "proc_ProductionOwnProductStatusLoadByPrimaryKey]", parameters);
		}
		
		#region Parameters
		protected class Parameters
		{
			
			public static SqlParameter IdOwnProduct
			{
				get
				{
					return new SqlParameter("@IdOwnProduct", SqlDbType.Int, 0);
				}
			}
			
			public static SqlParameter IdRegisterStatus
			{
				get
				{
					return new SqlParameter("@IdRegisterStatus", SqlDbType.Int, 0);
				}
			}
			
		}
		#endregion		
	
		#region ColumnNames
		public class ColumnNames
		{  
            public const string IdOwnProduct = "idOwnProduct";
            public const string IdRegisterStatus = "idRegisterStatus";

			static public string ToPropertyName(string columnName)
			{
				if(ht == null)
				{
					ht = new Hashtable();
					
					ht[IdOwnProduct] = _ProductionOwnProductStatus.PropertyNames.IdOwnProduct;
					ht[IdRegisterStatus] = _ProductionOwnProductStatus.PropertyNames.IdRegisterStatus;

				}
				return (string)ht[columnName];
			}

			static private Hashtable ht = null;			 
		}
		#endregion
		
		#region PropertyNames
		public class PropertyNames
		{  
            public const string IdOwnProduct = "IdOwnProduct";
            public const string IdRegisterStatus = "IdRegisterStatus";

			static public string ToColumnName(string propertyName)
			{
				if(ht == null)
				{
					ht = new Hashtable();
					
					ht[IdOwnProduct] = _ProductionOwnProductStatus.ColumnNames.IdOwnProduct;
					ht[IdRegisterStatus] = _ProductionOwnProductStatus.ColumnNames.IdRegisterStatus;

				}
				return (string)ht[propertyName];
			}

			static private Hashtable ht = null;			 
		}			 
		#endregion	

		#region StringPropertyNames
		public class StringPropertyNames
		{  
            public const string IdOwnProduct = "s_IdOwnProduct";
            public const string IdRegisterStatus = "s_IdRegisterStatus";

		}
		#endregion		
		
		#region Properties
	
		public virtual int IdOwnProduct
	    {
			get
	        {
				return base.Getint(ColumnNames.IdOwnProduct);
			}
			set
	        {
				base.Setint(ColumnNames.IdOwnProduct, value);
			}
		}

		public virtual int IdRegisterStatus
	    {
			get
	        {
				return base.Getint(ColumnNames.IdRegisterStatus);
			}
			set
	        {
				base.Setint(ColumnNames.IdRegisterStatus, value);
			}
		}


		#endregion
		
		#region String Properties
	
		public virtual string s_IdOwnProduct
	    {
			get
	        {
				return this.IsColumnNull(ColumnNames.IdOwnProduct) ? string.Empty : base.GetintAsString(ColumnNames.IdOwnProduct);
			}
			set
	        {
				if(string.Empty == value)
					this.SetColumnNull(ColumnNames.IdOwnProduct);
				else
					this.IdOwnProduct = base.SetintAsString(ColumnNames.IdOwnProduct, value);
			}
		}

		public virtual string s_IdRegisterStatus
	    {
			get
	        {
				return this.IsColumnNull(ColumnNames.IdRegisterStatus) ? string.Empty : base.GetintAsString(ColumnNames.IdRegisterStatus);
			}
			set
	        {
				if(string.Empty == value)
					this.SetColumnNull(ColumnNames.IdRegisterStatus);
				else
					this.IdRegisterStatus = base.SetintAsString(ColumnNames.IdRegisterStatus, value);
			}
		}


		#endregion		
	
		#region Where Clause
		public class WhereClause
		{
			public WhereClause(BusinessEntity entity)
			{
				this._entity = entity;
			}
			
			public TearOffWhereParameter TearOff
			{
				get
				{
					if(_tearOff == null)
					{
						_tearOff = new TearOffWhereParameter(this);
					}

					return _tearOff;
				}
			}

			#region WhereParameter TearOff's
			public class TearOffWhereParameter
			{
				public TearOffWhereParameter(WhereClause clause)
				{
					this._clause = clause;
				}
				
				
				public WhereParameter IdOwnProduct
				{
					get
					{
							WhereParameter where = new WhereParameter(ColumnNames.IdOwnProduct, Parameters.IdOwnProduct);
							this._clause._entity.Query.AddWhereParameter(where);
							return where;
					}
				}

				public WhereParameter IdRegisterStatus
				{
					get
					{
							WhereParameter where = new WhereParameter(ColumnNames.IdRegisterStatus, Parameters.IdRegisterStatus);
							this._clause._entity.Query.AddWhereParameter(where);
							return where;
					}
				}


				private WhereClause _clause;
			}
			#endregion
		
			public WhereParameter IdOwnProduct
		    {
				get
		        {
					if(_IdOwnProduct_W == null)
	        	    {
						_IdOwnProduct_W = TearOff.IdOwnProduct;
					}
					return _IdOwnProduct_W;
				}
			}

			public WhereParameter IdRegisterStatus
		    {
				get
		        {
					if(_IdRegisterStatus_W == null)
	        	    {
						_IdRegisterStatus_W = TearOff.IdRegisterStatus;
					}
					return _IdRegisterStatus_W;
				}
			}

			private WhereParameter _IdOwnProduct_W = null;
			private WhereParameter _IdRegisterStatus_W = null;

			public void WhereClauseReset()
			{
				_IdOwnProduct_W = null;
				_IdRegisterStatus_W = null;

				this._entity.Query.FlushWhereParameters();

			}
	
			private BusinessEntity _entity;
			private TearOffWhereParameter _tearOff;
			
		}
	
		public WhereClause Where
		{
			get
			{
				if(_whereClause == null)
				{
					_whereClause = new WhereClause(this);
				}
		
				return _whereClause;
			}
		}
		
		private WhereClause _whereClause = null;	
		#endregion
	
		#region Aggregate Clause
		public class AggregateClause
		{
			public AggregateClause(BusinessEntity entity)
			{
				this._entity = entity;
			}
			
			public TearOffAggregateParameter TearOff
			{
				get
				{
					if(_tearOff == null)
					{
						_tearOff = new TearOffAggregateParameter(this);
					}

					return _tearOff;
				}
			}

			#region AggregateParameter TearOff's
			public class TearOffAggregateParameter
			{
				public TearOffAggregateParameter(AggregateClause clause)
				{
					this._clause = clause;
				}
				
				
				public AggregateParameter IdOwnProduct
				{
					get
					{
							AggregateParameter aggregate = new AggregateParameter(ColumnNames.IdOwnProduct, Parameters.IdOwnProduct);
							this._clause._entity.Query.AddAggregateParameter(aggregate);
							return aggregate;
					}
				}

				public AggregateParameter IdRegisterStatus
				{
					get
					{
							AggregateParameter aggregate = new AggregateParameter(ColumnNames.IdRegisterStatus, Parameters.IdRegisterStatus);
							this._clause._entity.Query.AddAggregateParameter(aggregate);
							return aggregate;
					}
				}


				private AggregateClause _clause;
			}
			#endregion
		
			public AggregateParameter IdOwnProduct
		    {
				get
		        {
					if(_IdOwnProduct_W == null)
	        	    {
						_IdOwnProduct_W = TearOff.IdOwnProduct;
					}
					return _IdOwnProduct_W;
				}
			}

			public AggregateParameter IdRegisterStatus
		    {
				get
		        {
					if(_IdRegisterStatus_W == null)
	        	    {
						_IdRegisterStatus_W = TearOff.IdRegisterStatus;
					}
					return _IdRegisterStatus_W;
				}
			}

			private AggregateParameter _IdOwnProduct_W = null;
			private AggregateParameter _IdRegisterStatus_W = null;

			public void AggregateClauseReset()
			{
				_IdOwnProduct_W = null;
				_IdRegisterStatus_W = null;

				this._entity.Query.FlushAggregateParameters();

			}
	
			private BusinessEntity _entity;
			private TearOffAggregateParameter _tearOff;
			
		}
	
		public AggregateClause Aggregate
		{
			get
			{
				if(_aggregateClause == null)
				{
					_aggregateClause = new AggregateClause(this);
				}
		
				return _aggregateClause;
			}
		}
		
		private AggregateClause _aggregateClause = null;	
		#endregion
	
		protected override IDbCommand GetInsertCommand() 
		{
		
			SqlCommand cmd = new SqlCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "[" + this.SchemaStoredProcedure + "proc_ProductionOwnProductStatusInsert]";
	
			CreateParameters(cmd);
			    
			return cmd;
		}
	
		protected override IDbCommand GetUpdateCommand()
		{
		
			SqlCommand cmd = new SqlCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "[" + this.SchemaStoredProcedure + "proc_ProductionOwnProductStatusUpdate]";
	
			CreateParameters(cmd);
			      
			return cmd;
		}
	
		protected override IDbCommand GetDeleteCommand()
		{
		
			SqlCommand cmd = new SqlCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "[" + this.SchemaStoredProcedure + "proc_ProductionOwnProductStatusDelete]";
	
			SqlParameter p;
			p = cmd.Parameters.Add(Parameters.IdOwnProduct);
			p.SourceColumn = ColumnNames.IdOwnProduct;
			p.SourceVersion = DataRowVersion.Current;

  
			return cmd;
		}
		
		private IDbCommand CreateParameters(SqlCommand cmd)
		{
			SqlParameter p;
		
			p = cmd.Parameters.Add(Parameters.IdOwnProduct);
			p.SourceColumn = ColumnNames.IdOwnProduct;
			p.SourceVersion = DataRowVersion.Current;

			p = cmd.Parameters.Add(Parameters.IdRegisterStatus);
			p.SourceColumn = ColumnNames.IdRegisterStatus;
			p.SourceVersion = DataRowVersion.Current;


			return cmd;
		}
	}
}
